﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrogEngine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace TestGame
{
	public class GameplayScreen : GameScreen
	{
		public GameplayScreen(IEngine engine)
			: base(engine)
		{
			this.StateName = "GameplayScreen";

			Services.Add(engine.GetService<GameContentService>());
			// Handle Input is instead called through the GameStateManagementServices ScreenManager (in Update)
			//Services.Add(engine.GetService<GamePadInputService>());
			//Services.Add(engine.GetService<KeyboardInputService>());

			foreach (var service in Services)
				service.Subscribe(this);
		}

		public override IEnumerable<string> AssetNames()
		{
			return new List<string>();
		}

		public override void HandleInput(GameTime gameTime, FrogEngine.PlayerIndex index, GamePadState currentState, GamePadState previousState)
		{
			base.HandleInput(gameTime, index, currentState, previousState);
		}

		public override void HandleInput(GameTime gameTime, FrogEngine.PlayerIndex index, KeyboardState currentState, KeyboardState previousState)
		{
			base.HandleInput(gameTime, index, currentState, previousState);
			if (currentState.IsKeyDown(Keys.Enter) && previousState.IsKeyUp(Keys.Enter))
				this.ScreenManager.Transition(this.Transitions["PauseScreen"] as IGameScreen);
		}
	}
}
